index_app.controller("member_management_edit", function ($scope,$http,$routeParams,$timeout) {
    $scope.params=$routeParams;
	$scope.memberKey = $scope.params.key;

    $scope.vipTypeArry=['普通会员','白银会员','至尊会员'];
    $scope.payMethod=['现金','支付宝','微信'];

    $http.post("menberInfo/selectByMemberKey?memberKey="+$scope.memberKey).then(function(response){
    	//数据源
    	$scope.memberManagement = response.data;
    });


    $http.post("stmUsr/selectAll").then(function(response){
    	//数据源
    	$scope.stmUsrList = response.data;
    });

    $http.post("activity/selectAll").then(function(response){
        	//数据源
        	$scope.activityList = response.data;
        });

	//用户信息修改页面中保存操作
	$scope.memberManagementUpdate = function(memberManagement){
           memberManagement.balance = memberManagement.activityAmount*1 + memberManagement.amount*1;
            console.log( memberManagement.balance);
        		$http({
        			method  : 'POST',
        			url     : 'menberInfo/saveOrUpdate',
        			data    : memberManagement,//传递真个对象到后台
        		}).success(function(data) {
        			if(data == 1){
        				//添加保存标题样式
        				$scope.title = '<h4 class="easyDialog_title" id="easyDialogTitle"><i class="icon-ok green"></i> <a href="javascript:void(0)" title="关闭窗口" class="close_btn" id="closeBtn">&times;</a>保存</h4>';
        				//保存成功内容
        				$scope.toolTip = "保存成功";
        				//弹窗
        				toolTipDialog();
        				$scope.success = true;

        			} else {
        				$scope.title = "保存";
        				$scope.toolTip = "保存失败";
        				toolTipDialog();
        			}
        		});
	};

	function toolTipDialog(){
    		easyDialog.open({
    			container : {
    				header : $scope.title,
    				content : $scope.toolTip,
    				yesFn : $scope.toolFn,
    				noFn : false
    			},
    			fixed : false
    		});
    	}
    	//弹窗中确定按钮事件
        	$scope.toolFn = function(){
        		if( $scope.success){//成功
        			window.location.href="#member_management_list";
        		}
        		return true;
        	}

})